package Practice.P01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Practice03 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"小平平","小美美","小垃圾","大垃圾","小水水","小悄悄","小长长");
        int count = list.size();
        Random r = new Random();
        ArrayList<String> list1 = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            System.out.println("-----第"+ i +"次循环-----");
            for (int j = 0; j < count; j++) {
                int index = r.nextInt(list.size());
                String name = list.remove(index);
                list1.add(name);
                System.out.println(name);
            }
            list.addAll(list1);
            list1.clear();
        }


    }
}
